/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package gridworld_v04;

/**
 *
 * @author Jonah
 */
public abstract class Actor {
    /*implementation comment*/
    ////<editor-fold defaultstate="collapsed" desc="Static Variables">
    //</editor-fold>
    ////<editor-fold desc="Instanced Variables">
    protected Tile currentTile;
    private Game game;
    private Board board;
    private boolean dead = false;
    public int lifeSpan, needsToEat;

    public Game getGame() {
        return game;
    }
    public Tile getCurrentTile() {
        return currentTile;
    }
    public void setLifeSpan(int lifeSpan) {
        this.lifeSpan = lifeSpan;
    }
    public void setNeedToeat(int hunger){
        needsToEat = hunger;
    }
    public boolean isDead() {
        return dead;
    }
    
    //</editor-fold>
    ////<editor-fold defaultstate="collapsed" desc="Constructor">
    public Actor(Tile currentTile, Game game, Board board) {
        this.currentTile = currentTile;
        this.game = game;
        this.board = board;
        
        game.addActorReference(this);
    }
    //</editor-fold>
    ////<editor-fold desc="Class Methods">
    public abstract void checkSafeTiles();
    public abstract void move();
    public final void moveToTile(Tile tile){
        currentTile.removeOccupant(this);
        currentTile = tile;
        currentTile.addOccupant(this);
    }
    public final void remove(){
        game.removeActorReference(this);
        currentTile.removeOccupant(this);
        dead = true;
        //at this point is this instace eligible for garbage collection?
    }
    //</editor-fold>
    ////<editor-fold defaultstate="collapsed" desc="Interface Override Methods">
    //</editor-fold>
}
